<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>let const</title>
	</head>
	<body>
		<script>
			let y = 90;
			function func(x = y + 1) {
				console.log(x);
			}
			func();//91
			y = 100;
			func();//101
			console.log(func.name);
			
			var fn=function(){
				
			}
			console.log(fn.name);//fn
			
			const fullName=({first,last})=> first+"."+last;
			console.log(fullName({first:"尼古拉斯",last:"赵四"}));
			
			let arr=[1,2,3,4].map(function(n){
				return n*n;
			});
			//箭头函数
			arr=[1,2,3,4].map( x=>x*x);
			console.log(arr);
			
			function Point(x=0,y=0){
				this.x=x;
				this.y=y;
			}
			const p1=new Point();
			 
			let P= (x,y)=> {this.x=x; this.y=y;}
			new P();//Uncaught TypeError: P is not a constructor
			
		</script>
	</body>
</html>
